package com.gofun.framework.dubbo.core.environment.config;

import com.gofun.framework.dubbo.core.environment.ConfigMapping;
import com.gofun.framework.dubbo.core.environment.ResolveMappingStrategy;
import com.gofun.framework.dubbo.core.environment.DefaultResolveStrategy.ResolveStrategyEnum;

/**
 * @Project       : framework-dubbo-core
 * @Program Name  : com.ljt.framework.dubbo.core.environment.property.RegistryConfigEnum.java
 * @Description   : TODO wangchao 类描述
 * @Author        : wangchao
 * @Creation Date : 2016年5月27日 下午4:14:09 
 * @ModificationHistory  
 * Who          When             What 
 * ----------   -------------    -----------------------------------
 * wangchao     2016年5月27日        create
 */
public enum RegistryConfigEnum implements ConfigMapping {
	
	ADDRESS("dubbo.registry.address","注册中心地址"),
	
	USERNAME("dubbo.registry.username","登录注册中心用户名，如果注册中心不需要验证可不填 "),
	
	PASSWORD("dubbo.registry.password","登录注册中心密码，如果注册中心不需要验证可不填"),
	
	REGISTER("dubbo.registry.register","是否向此注册中心注册服务，如果设为false，将只订阅，不注册 ",DEV_ACTIVATED),
	
	SUBSCRIBE("dubbo.registry.subscribe","是否向此注册中心订阅服务，如果设为false，将只注册，不订阅  ",DEV_ACTIVATED);
	
	public String code;
	
	public String text;
	
	public String[] activated;

	public ResolveMappingStrategy resolveMapping;
	
	private RegistryConfigEnum(String code,String text) {
		this(code, text,ResolveStrategyEnum.DIRECT.resolve, ALL_ACTIVATED);
	}
	
	private RegistryConfigEnum(String code,String text,String... activated) {
		this(code, text, ResolveStrategyEnum.DIRECT.resolve, activated);
	}
	
	private RegistryConfigEnum(String code,String text,ResolveMappingStrategy resolveMapping,String... activated) {
		this.code = code;
		this.text = text;
		this.activated = activated;
		this.resolveMapping = resolveMapping;
	}
	
	@Override
	public ResolveMappingStrategy getResolveMapping() {
		return resolveMapping;
	}

	@Override
	public String getCode() {
		return code;
	}

	@Override
	public String getText() {
		return text;
	}
	
	public String[] getActivated() {
		return activated;
	}

}
